package com.util;

import lombok.AllArgsConstructor;
import lombok.Data;


public class ResultUtils {
    public static ResultVo vo(String msg, int code, Object data) {
        return new ResultVo(msg,code,data);
    }
    public static ResultVo success() {
        return vo(null,StatusCode.SUCCESS_CODE, null);
    }
    public static ResultVo success(String msg) {
        return vo(msg, StatusCode.SUCCESS_CODE, null);
    }
    // 放回带参数
    public static ResultVo success(String msg, Object data) {
        return vo(msg, StatusCode.SUCCESS_CODE, data);
    }
    // 错误返回
    public static ResultVo error() {
        return vo(null, StatusCode.ERROR_CODE, null);
    }
    public static ResultVo error(String msg) {
        return vo(msg,StatusCode.ERROR_CODE,null);
    }
    public static ResultVo error(String msg,int code) {
        return vo(msg,code,null);
    }
    public static ResultVo error(String msg,Object data) {
        return vo(msg ,StatusCode.ERROR_CODE ,data);
    }
    // 分页数据的返回
//    public static ResultPageVo success(String msg,Integer pageNum,Integer pageSize, Integer total,Object data) {
//        return new ResultPageVo(null,StatusCode.SUCCESS_CODE,pageNum,pageSize,total,data);
//    }
    // 分页数据获取失败
//    public static ResultPageVo errorpage(String msg) {
//        return new ResultPageVo(msg,null,null,null,null,null);
//    }
}
